package org.metasketch.demo.diagrams.OFD;

import org.metasketch.demo.model.OrganizationalFunction;
import org.metasketch.diagram.javafx.graphics.DefaultLink;
import org.metasketch.diagram.javafx.graphics.HorizontalLinkLabelPosition;
import org.metasketch.diagram.javafx.graphics.LinkEndBuilder;
import org.metasketch.diagram.javafx.graphics.PositionedLabel;
import org.metasketch.diagram.javafx.graphics.VerticalLinkLabelPosition;
import org.metasketch.editor.links.LinkEndType;
import org.metasketch.ham.model.HumanActivityRelationLink;
import org.metasketch.ham.model.HumanActivityRelationType;

public class InheritLink extends DefaultLink {

	// PositionedLabel label = new PositionedLabel();

	// public InheritLink() {
	//
	// }

	@Override
	protected void refreshModelGraphic() {
		super.refreshModelGraphic();

		// if (semantic == null)
		// return;

		OrganizationalFunction sourceOrg = (OrganizationalFunction) source
				.getSemantic();
		OrganizationalFunction targetOrg = (OrganizationalFunction) target
				.getSemantic();

		if (sourceOrg.getInheritedOrganizationalFunctions().contains(targetOrg))
			LinkEndBuilder.buildEnd(this, getLastSection(),
					LinkEndType.TRIANGLE, false);
		else
			LinkEndBuilder.buildEnd(this, getFirstSection(),
					LinkEndType.TRIANGLE, true);

	}

}
